VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Baranggay Health Office: Admission Form"
   ClientHeight    =   9120
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   9120
   ScaleWidth      =   9000
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame5 
      Caption         =   "Search"
      Height          =   1815
      Left            =   4800
      TabIndex        =   34
      Top             =   720
      Width           =   4095
      Begin VB.CommandButton Command5 
         Caption         =   "Search"
         Height          =   735
         Left            =   120
         TabIndex        =   38
         Top             =   960
         Width           =   3855
      End
      Begin VB.TextBox Text10 
         Height          =   285
         Left            =   120
         TabIndex        =   37
         Text            =   "Text10"
         Top             =   600
         Width           =   3855
      End
      Begin VB.ComboBox Combo3 
         Height          =   315
         ItemData        =   "Form1.frx":0000
         Left            =   960
         List            =   "Form1.frx":0019
         TabIndex        =   36
         Text            =   "Record ID"
         Top             =   240
         Width           =   3015
      End
      Begin VB.Label Label14 
         Caption         =   "Search by"
         Height          =   255
         Left            =   120
         TabIndex        =   35
         Top             =   240
         Width           =   975
      End
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1
      Left            =   120
      Top             =   8520
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "Form1.frx":0067
      Height          =   1815
      Left            =   120
      TabIndex        =   32
      Top             =   720
      Width           =   4575
      _ExtentX        =   8070
      _ExtentY        =   3201
      _Version        =   393216
      AllowUpdate     =   0   'False
      AllowArrows     =   0   'False
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   13
      BeginProperty Column00 
         DataField       =   "recNum"
         Caption         =   "recNum"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "recDate"
         Caption         =   "recDate"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "p_last"
         Caption         =   "p_last"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "p_first"
         Caption         =   "p_first"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "P_middle"
         Caption         =   "P_middle"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "p_age"
         Caption         =   "p_age"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "p_add_num"
         Caption         =   "p_add_num"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column07 
         DataField       =   "p_add_brng"
         Caption         =   "p_add_brng"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column08 
         DataField       =   "p_add_ct"
         Caption         =   "p_add_ct"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column09 
         DataField       =   "p_add_prov"
         Caption         =   "p_add_prov"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column10 
         DataField       =   "ailment"
         Caption         =   "ailment"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column11 
         DataField       =   "med"
         Caption         =   "med"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column12 
         DataField       =   "recom"
         Caption         =   "recom"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
            ColumnWidth     =   915.024
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   915.024
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   915.024
         EndProperty
         BeginProperty Column07 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column08 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column09 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column10 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column11 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column12 
            ColumnWidth     =   1739.906
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc Adodc3 
      Height          =   375
      Left            =   3120
      Top             =   3000
      Visible         =   0   'False
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   $"Form1.frx":007C
      OLEDBString     =   $"Form1.frx":0120
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "medications"
      Caption         =   "Adodc3"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   375
      Left            =   1680
      Top             =   3000
      Visible         =   0   'False
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   $"Form1.frx":01C4
      OLEDBString     =   $"Form1.frx":0268
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "ailments"
      Caption         =   "Adodc2"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   120
      Top             =   3000
      Visible         =   0   'False
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   $"Form1.frx":030C
      OLEDBString     =   $"Form1.frx":03B0
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "records"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Exit"
      Height          =   495
      Left            =   6840
      TabIndex        =   31
      Top             =   8520
      Width           =   2055
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Delete"
      Height          =   495
      Left            =   4680
      TabIndex        =   30
      Top             =   8520
      Width           =   2055
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Edit"
      Height          =   495
      Left            =   2640
      TabIndex        =   29
      Top             =   8520
      Width           =   1935
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Save"
      Height          =   495
      Left            =   600
      TabIndex        =   28
      Top             =   8520
      Width           =   1935
   End
   Begin VB.Frame Frame4 
      Caption         =   "Recommendation"
      Height          =   1455
      Left            =   120
      TabIndex        =   27
      Top             =   6960
      Width           =   8775
      Begin VB.TextBox Text9 
         Height          =   1095
         Left            =   120
         TabIndex        =   11
         Text            =   "Text9"
         Top             =   240
         Width           =   8535
      End
   End
   Begin MSComCtl2.DTPicker DTPicker1 
      Height          =   375
      Left            =   5760
      TabIndex        =   0
      Top             =   3000
      Width           =   3135
      _ExtentX        =   5530
      _ExtentY        =   661
      _Version        =   393216
      Format          =   16449537
      CurrentDate     =   41087
   End
   Begin VB.Frame Frame3 
      Caption         =   "Diagnosis"
      Height          =   1095
      Left            =   120
      TabIndex        =   22
      Top             =   5760
      Width           =   8775
      Begin VB.CommandButton Command7 
         Caption         =   "..."
         Height          =   255
         Left            =   8160
         TabIndex        =   40
         Top             =   600
         Width           =   495
      End
      Begin VB.CommandButton Command6 
         Caption         =   "..."
         Height          =   255
         Left            =   8160
         TabIndex        =   39
         Top             =   240
         Width           =   495
      End
      Begin VB.TextBox Text8 
         Height          =   285
         Left            =   600
         TabIndex        =   8
         Text            =   "Text8"
         Top             =   240
         Width           =   1095
      End
      Begin VB.ComboBox Combo2 
         DataSource      =   "Adodc3"
         Height          =   315
         Left            =   1080
         TabIndex        =   10
         Text            =   "-SELECT ONE-"
         Top             =   600
         Width           =   6975
      End
      Begin VB.ComboBox Combo1 
         DataSource      =   "Adodc2"
         Height          =   315
         Left            =   2400
         TabIndex        =   9
         Text            =   "-SELECT ONE-"
         Top             =   240
         Width           =   5655
      End
      Begin VB.Label Label12 
         Caption         =   "Age"
         Height          =   255
         Left            =   120
         TabIndex        =   26
         Top             =   240
         Width           =   375
      End
      Begin VB.Label Label10 
         Caption         =   "Medication"
         Height          =   255
         Left            =   120
         TabIndex        =   24
         Top             =   600
         Width           =   975
      End
      Begin VB.Label Label9 
         Caption         =   "Ailment"
         Height          =   255
         Left            =   1800
         TabIndex        =   23
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Patient Address"
      Height          =   975
      Left            =   120
      TabIndex        =   7
      Top             =   4680
      Width           =   8775
      Begin VB.TextBox Text7 
         Height          =   285
         Left            =   6120
         TabIndex        =   17
         Text            =   "Text7"
         Top             =   240
         Width           =   2535
      End
      Begin VB.TextBox Text6 
         Height          =   285
         Left            =   3600
         TabIndex        =   6
         Text            =   "Text6"
         Top             =   240
         Width           =   2415
      End
      Begin VB.TextBox Text5 
         Height          =   285
         Left            =   960
         TabIndex        =   5
         Text            =   "Text5"
         Top             =   240
         Width           =   2535
      End
      Begin VB.TextBox Text4 
         Height          =   285
         Left            =   120
         TabIndex        =   4
         Text            =   "Text4"
         Top             =   240
         Width           =   735
      End
      Begin VB.Label Label8 
         Caption         =   "Province"
         Height          =   255
         Left            =   6120
         TabIndex        =   21
         Top             =   600
         Width           =   2535
      End
      Begin VB.Label Label7 
         Caption         =   "City/Town"
         Height          =   255
         Left            =   3600
         TabIndex        =   20
         Top             =   600
         Width           =   2415
      End
      Begin VB.Label Label6 
         Caption         =   "Baranggay"
         Height          =   255
         Left            =   960
         TabIndex        =   19
         Top             =   600
         Width           =   2655
      End
      Begin VB.Label Label5 
         Caption         =   "House #"
         Height          =   255
         Left            =   120
         TabIndex        =   18
         Top             =   600
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Patient Name"
      Height          =   975
      Left            =   120
      TabIndex        =   13
      Top             =   3600
      Width           =   8775
      Begin VB.TextBox Text3 
         Height          =   285
         Left            =   6240
         TabIndex        =   3
         Text            =   "Text3"
         Top             =   240
         Width           =   2415
      End
      Begin VB.TextBox Text2 
         Height          =   285
         Left            =   2760
         TabIndex        =   2
         Text            =   "Text2"
         Top             =   240
         Width           =   3375
      End
      Begin VB.TextBox Text1 
         Height          =   285
         Left            =   120
         TabIndex        =   1
         Text            =   "Text1"
         Top             =   240
         Width           =   2535
      End
      Begin VB.Label Label4 
         Caption         =   "Middle Name"
         Height          =   255
         Left            =   6240
         TabIndex        =   16
         Top             =   600
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "First Name"
         Height          =   255
         Left            =   2760
         TabIndex        =   15
         Top             =   600
         Width           =   1215
      End
      Begin VB.Label Label2 
         Caption         =   "Last Name"
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   600
         Width           =   1215
      End
   End
   Begin VB.Label Label13 
      Alignment       =   2  'Center
      Caption         =   "<MESSAGE GOES HERE>"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   33
      Top             =   2640
      Width           =   8775
   End
   Begin VB.Label Label11 
      Caption         =   "Date"
      Height          =   255
      Left            =   5040
      TabIndex        =   25
      Top             =   3000
      Width           =   615
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "Baranggay Health Care"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   120
      TabIndex        =   12
      Top             =   120
      Width           =   8775
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public recID As Integer
Public time1 As Double
Public f1 As String
Public f2 As String
Public f3 As String

Sub allclear()
    DTPicker1.Value = Date
    Combo1.Text = "-SELECT ONE-"
    Combo2.Text = "-SELECT ONE-"
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text7.Text = ""
    Text8.Text = ""
    Text9.Text = ""
    Text10.Text = ""
    Command1.Enabled = False
    Command2.Enabled = False
    Command3.Enabled = False
    Text1.BackColor = &HFFFFFF
    Text2.BackColor = &HFFFFFF
    Text3.BackColor = &HFFFFFF
    Text4.BackColor = &HFFFFFF
    Text5.BackColor = &HFFFFFF
    Text6.BackColor = &HFFFFFF
    Text7.BackColor = &HFFFFFF
    Text8.BackColor = &HFFFFFF
    Text9.BackColor = &HFFFFFF
End Sub

Sub check_inputs()
    If Not (Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" _
    Or Text5.Text = "" Or Text6.Text = "" Or Text8.Text = "" Or Text9.Text = "" _
    Or Combo1.Text = "-SELECT ONE-" Or Combo2.Text = "-SELECT ONE-" Or _
    Command1.Enabled = True Or Command2.Enabled = True) _
    Then Command1.Enabled = True
End Sub
Sub fill_combo()
    Dim i As Integer
    Dim j As Integer
    
    Adodc2.Recordset.MoveFirst
    Adodc3.Recordset.MoveFirst
    
    While Not Adodc2.Recordset.EOF
        Combo1.AddItem (Adodc2.Recordset("ailment"))
        Adodc2.Recordset.MoveNext
    Wend
    While Not Adodc3.Recordset.EOF
        Combo2.AddItem (Adodc3.Recordset("med"))
        Adodc3.Recordset.MoveNext
    Wend
End Sub

Private Sub Combo1_Click()
    check_inputs
End Sub

Private Sub Combo2_Click()
    check_inputs
End Sub

Private Sub Command1_Click()
    With Adodc1.Recordset
        .AddNew
        .Fields("recDate") = DTPicker1.Value
        .Fields("p_last") = Text1.Text
        .Fields("p_first") = Text2.Text
        .Fields("p_middle") = Text3.Text
        .Fields("p_age") = Text8.Text
        .Fields("p_add_num") = Text4.Text
        .Fields("p_add_brng") = Text5.Text
        .Fields("p_add_ct") = Text6.Text
        .Fields("p_add_prov") = Text7.Text
        .Fields("ailment") = Combo1.Text
        .Fields("med") = Combo2.Text
        .Fields("recom") = Text9.Text
        .Update
    End With
    Label13.BackColor = ColorConstants.vbGreen
    time1 = 0
    Timer1.Enabled = True
    Label13.Visible = True
    Label13.Caption = "Record saved for " + Text1.Text + ", " + Text2.Text + " " + Text3.Text
    allclear
End Sub

Private Sub Command2_Click()
    Dim i As Integer
    With Adodc1.Recordset
        .MoveFirst
        While Not .EOF
            If recID = .Fields("recNum") Then
                .Fields("recDate") = DTPicker1.Value
                .Fields("p_last") = Text1.Text
                .Fields("p_first") = Text2.Text
                .Fields("p_middle") = Text3.Text
                .Fields("p_age") = Text8.Text
                .Fields("p_add_num") = Text4.Text
                .Fields("p_add_brng") = Text5.Text
                .Fields("p_add_ct") = Text6.Text
                .Fields("p_add_prov") = Text7.Text
                .Fields("ailment") = Combo1.Text
                .Fields("med") = Combo2.Text
                .Fields("recom") = Text9.Text
                .Update
                time1 = 0
                Timer1.Enabled = False
                Label13.Visible = False
                Label13.Caption = ""
                Command1.Enabled = False
                Command2.Enabled = False
                Command3.Enabled = False
            End If
            .MoveNext
        Wend
    End With
    allclear
End Sub

Private Sub Command3_Click()
    With Adodc1.Recordset
        .MoveFirst
        Do While Not .EOF
            If .Fields("recNum") = recID Then Exit Do
            .MoveNext
        Loop
        .Delete
        .Update
    End With
    allclear
End Sub

Private Sub Command4_Click()
    End
End Sub

Private Sub Command5_Click()
    Dim field As String
    
    Select Case Combo3.Text
        Case "Record ID"
            field = "recNum"
            searchBySingle (field)
        Case "Last Name"
            field = "p_last"
            searchBySingle (field)
        Case "First Name"
            field = "p_first"
            searchBySingle (field)
        Case "Middle Name"
            field = "p_middle"
            searchBySingle (field)
        Case "FN MN LN"
            f1 = "p_first"
            f2 = "p_middle"
            f3 = "p_last"
            searchByMultiple
        Case "LN FN MN"
            f1 = "p_last"
            f2 = "p_first"
            f3 = "p_middle"
            searchByMultiple
        Case "FN LN"
            f1 = "p_first"
            f2 = "p_last"
            f3 = "*"
            searchByMultiple
    End Select
End Sub
Sub searchBySingle(ByVal field As String)
    Dim count As Integer
    
    With Adodc1.Recordset
        .MoveFirst
        While Not .EOF
            If LCase(.Fields(field)) = LCase(Text10.Text) Then count = count + 1
            .MoveNext
        Wend
        
        If count > 1 Then
            MsgBox "Your query returned more than one result"
        ElseIf count = 0 Then
            MsgBox "Your query doesn't return a result"
        Else
            .MoveFirst
            While Not .EOF
                If LCase(.Fields(field)) = LCase(Text10.Text) Then
                    recID = .Fields("recNum")
                    DTPicker1.Value = .Fields("recDate")
                    Text1.Text = .Fields("p_last")
                    Text2.Text = .Fields("p_first")
                    Text3.Text = .Fields("p_middle")
                    Text4.Text = .Fields("p_add_num")
                    Text5.Text = .Fields("p_add_brng")
                    Text6.Text = .Fields("p_add_ct")
                    Text7.Text = .Fields("p_add_prov")
                    Text8.Text = .Fields("p_age")
                    Text9.Text = .Fields("recom")
                    Combo1.Text = .Fields("ailment")
                    Combo2.Text = .Fields("med")
                    Label13.BackColor = ColorConstants.vbYellow
                    time1 = -99999
                    Timer1.Enabled = True
                    Label13.Visible = True
                    Label13.Caption = "Selected " + .Fields("p_last") + ", " + .Fields("p_first") + " " + .Fields("p_middle")
                    Command1.Enabled = False
                    Command2.Enabled = True
                    Command3.Enabled = True
                End If
                .MoveNext
            Wend
        End If
    End With
End Sub
Sub searchByMultiple()
    Dim count As Integer
    
    With Adodc1.Recordset
        .MoveFirst
        If f3 = "*" Then
            While Not .EOF
                If LCase(.Fields(f1) + " " + .Fields(f2)) = LCase(Text10.Text) Then count = count + 1
                .MoveNext
            Wend
            If count > 1 Then
                MsgBox "Your query returned more than one result"
            ElseIf count = 0 Then
                MsgBox "Your query doesn't return a result"
            Else
                .MoveFirst
                While Not .EOF
                    If LCase(.Fields(f1) + " " + .Fields(f2)) = LCase(Text10.Text) Then
                        recID = .Fields("recNum")
                        DTPicker1.Value = .Fields("recDate")
                        Text1.Text = .Fields("p_last")
                        Text2.Text = .Fields("p_first")
                        Text3.Text = .Fields("p_middle")
                        Text4.Text = .Fields("p_add_num")
                        Text5.Text = .Fields("p_add_brng")
                        Text6.Text = .Fields("p_add_ct")
                        Text7.Text = .Fields("p_add_prov")
                        Text8.Text = .Fields("p_age")
                        Text9.Text = .Fields("recom")
                        Combo1.Text = .Fields("ailment")
                        Combo2.Text = .Fields("med")
                        Label13.BackColor = ColorConstants.vbYellow
                        time1 = -99999
                        Timer1.Enabled = True
                        Label13.Visible = True
                        Label13.Caption = "Selected " + .Fields("p_last") + ", " + .Fields("p_first") + " " + .Fields("p_middle")
                        Command1.Enabled = False
                        Command2.Enabled = True
                        Command3.Enabled = True
                    End If
                    .MoveNext
                Wend
            End If
        Else
            While Not .EOF
                If LCase(.Fields(f1) + " " + .Fields(f2) + " " + .Fields(f3)) = LCase(Text10.Text) Then count = count + 1
                .MoveNext
            Wend
            If count > 1 Then
                MsgBox "Your query returned more than one result"
            ElseIf count = 0 Then
                MsgBox "Your query doesn't return a result"
            Else
                .MoveFirst
                While Not .EOF
                    If LCase(.Fields(f1) + " " + .Fields(f2) + " " + .Fields(f3)) = LCase(Text10.Text) Then
                        recID = .Fields("recNum")
                        DTPicker1.Value = .Fields("recDate")
                        Text1.Text = .Fields("p_last")
                        Text2.Text = .Fields("p_first")
                        Text3.Text = .Fields("p_middle")
                        Text4.Text = .Fields("p_add_num")
                        Text5.Text = .Fields("p_add_brng")
                        Text6.Text = .Fields("p_add_ct")
                        Text7.Text = .Fields("p_add_prov")
                        Text8.Text = .Fields("p_age")
                        Text9.Text = .Fields("recom")
                        Combo1.Text = .Fields("ailment")
                        Combo2.Text = .Fields("med")
                        Label13.BackColor = ColorConstants.vbYellow
                        time1 = -99999
                        Timer1.Enabled = True
                        Label13.Visible = True
                        Label13.Caption = "Selected " + .Fields("p_last") + ", " + .Fields("p_first") + " " + .Fields("p_middle")
                        Command1.Enabled = False
                        Command2.Enabled = True
                        Command3.Enabled = True
                    End If
                    .MoveNext
                Wend
            End If
        End If
    End With
End Sub

Private Sub Command6_Click()
    ailments.Show
End Sub

Private Sub Command7_Click()
    medications.Show
End Sub

Private Sub Form_Load()
    allclear
    Label13.Visible = False
    fill_combo
End Sub

Private Sub Text1_Change()
    check_inputs
    With Text1
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text2_Change()
    check_inputs
    With Text2
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text3_Change()
    check_inputs
    With Text3
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text4_Change()
    check_inputs
    With Text4
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text5_Change()
    check_inputs
    With Text5
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text6_Change()
    check_inputs
    With Text6
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text7_Change()
    check_inputs
    With Text7
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text8_Change()
    check_inputs
        With Text8
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Text9_Change()
    check_inputs
    With Text9
        If .Text = "" Then
            .BackColor = &H8080FF
        Else
            .BackColor = &HC0FFC0
        End If
    End With
End Sub

Private Sub Timer1_Timer()
    time1 = time1 + 1
    If time1 = 250 Then
        Label13.Visible = False
        Timer1.Enabled = False
        time1 = 0
    End If
End Sub
